主题
截图返回字节流 - GetScreenDataBmp
函数简介
获取指定区域的图像数据,以BMP格式二进制数据返回。此接口线程不安全,不推荐使用。
接口名称
GetScreenDataBmpDLL调用
int GetScreenDataBmp(long ola, int x1, int y1, int x2, int y2, long* data, int* size);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| x1 | 整数型 | 区域的左上X坐标 |
| y1 | 整数型 | 区域的左上Y坐标 |
| x2 | 整数型 | 区域的右下X坐标 |
| y2 | 整数型 | 区域的右下Y坐标 |
| data | 长整数型指针 | 返回BMP图片数据的指针地址 |
| size | 整数型指针 | 返回BMP图片数据的总长度(字节数) |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value");csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value");cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value")text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.GetScreenDataBmp(0, 0, 0, 0, “value”, “value”)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int32_t ret = ola.GetScreenDataBmp(0, 0, 0, 0, "value", "value");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
GetScreenDataBmp(instance, 0, 0, 0, 0, 0, 0);csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetScreenDataBmp(long ola, int x1, int y1, int x2, int y2, long data, int size);
long instance = CreateCOLAPlugInterFace();
GetScreenDataBmp(instance, 0, 0, 0, 0, 0, 0);python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.GetScreenDataBmp(instance, 0, 0, 0, 0, 0, 0)返回值
整数型:1 成功,0 失败。
注意事项
- 此接口线程不安全,建议使用 GetScreenDataPtr + GetImageBmpData + FreeImagePtr 替代。
- 返回的数据是标准BMP文件格式,包含BMP文件头。
- 数据指针在下次调用前有效,需及时拷贝数据。
- x1, y1, x2, y2 全传0时获取窗口整个客户区。
